<template>
	<view class="container">
		<view class="list flex flex-align flex-bt" v-for="(item,index) in articleList" :key="index" v-if='articleList.length!=0' @click='go_url("/pages/notice/news_details?id="+item.code+"&&type=1")'>
			<view class="left"><image :src='item.cover'></image></view>
			<view class="right">
				<view class="title  flex flex-align flex-bt">
					<view class="one uni-ellipsis">{{item.name}}</view>
				</view>
				<view class="content uni-ellipsis">{{item.create_at}}</view>
			</view>
		</view>
		<view class="empty-box" v-if='articleList.length==0'>
			<image src="https://firework.cyx.zzcyx1688.cn/web/static/noCart.png" mode=""></image>
			<view>暂无数据</view>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return {
				active: 0,
				scrollLeft:0,
				navList:[],
				articleList:[],
				page:1,
				is_show:"false"
			}
		},
		onShow() {
			this.page=1
			this.articleList = []
			this.getList()
		},
		onReachBottom() {
			this.is_show="false"
			this.page=1
			this.articleList = []
			this.getList()
		},
		methods: {
			getList(){
				let that = this
				that.tui.request("api.nutrition/itemList", "GET", {page:that.page,pageSize:20}, false, true, true).then((res) => {
					console.log(res)
					// that.tui.toast(res.info)
					that.articleList = that.articleList.concat(res.data.list)
					
				}).catch((res) => {})
			},
			go_url(e){
				this.tui.href(e)
			}
		},
	}
</script>

<style lang="scss">
	.list{border-bottom: 1px solid #eee;padding: 20rpx 30rpx 10rpx;
		.left{
			image{width: 100rpx;height: 100rpx;margin-right: 10rpx;}
		}
		.right{
			.title{font-weight: bold;
				.one{width: 500rpx;font-size: 30rpx;}
				.two{font-weight: 100;font-size: 26rpx;width: 250rpx;padding-top: 4rpx;}
			}
			.content{font-size: 26rpx;width: 550rpx;margin-top: 10rpx;color: #999;}
		}
	}
</style>